<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2021/5/6
  Time: 18:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Admin</title>
    <style>
        table tr th,table tr td{
            border: 1px solid coral;
            text-align: center;
        }
        a{
            color: #0000ff;
            text-decoration: none;
            cursor: pointer;
        }
        span{
            color: #ef2f89;
        }
        .welcome{
            float: left;
        }
        img{
            max-width: 70px;
            max-height: 70px;
        }
    </style>
</head>
<body>
<c:choose>
    <c:when test="${sessionScope.username == null || sessionScope.username.equals(\"\")}">
        <h1>您还未登录或登录已过期，请前往登录：</h1>
        <h1><a href="login">登录</a></h1>
    </c:when>
    <c:otherwise>
        <h3 class="welcome">欢迎你,${username}</h3><img alt="头像" title="头像" src="img?username=${username}">
        <h3>当前在线人数为 <span>${onLineNum}</span> 人</h3>
        <h1>用户管理</h1>
        <table>
            <tr>
                <th>用户名</th>
                <th>密码</th>
                <th>真实姓名</th>
                <th>头像</th>
                <th>email</th>
                <th>电话</th>
                <th>来源</th>
                <th>操作</th>
            </tr>
            <c:forEach items="${requestScope.list}" var="user">
                <tr>
                    <td>${user.username}</td>
                    <td>${user.password}</td>
                    <td>${user.realname}</td>
                    <td>${user.imgurl}</td>
                    <td>${user.email}</td>
                    <td>${user.phone}</td>
                    <td>${user.source}</td>
                    <td>
                        <a href="user?method=delete&username=${user.username}">删除</a>
                        <a href="user?method=findByUsername&username=${user.username}">修改</a>
                    </td>
                </tr>
            </c:forEach>
            <tr>
                <td>
                    <a href="add.jsp">添加</a>
                </td>
            </tr>
        </table>
    </c:otherwise>
</c:choose>
</body>
</html>
